/*
** Lua binding: User
** Generated automatically by tolua++-1.0.92 on Thu Feb 20 20:48:45 2014.
*/

#ifndef __cplusplus
#include "stdlib.h"
#endif
#include "string.h"

#include "tolua++.h"

/* Exported function */
TOLUA_API int  tolua_User_open (lua_State* tolua_S);

#include "User.h"

/* function to release collected object via destructor */
#ifdef __cplusplus

static int tolua_collect_CUser (lua_State* tolua_S)
{
 CUser* self = (CUser*) tolua_tousertype(tolua_S,1,0);
	Mtolua_delete(self);
	return 0;
}
#endif


/* function to register type */
static void tolua_reg_types (lua_State* tolua_S)
{
 tolua_usertype(tolua_S,"CUser");
}

/* method: new of class  CUser */
#ifndef TOLUA_DISABLE_tolua_User_CUser_new00
static int tolua_User_CUser_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"CUser",0,&tolua_err) ||
     !tolua_isstring(tolua_S,2,0,&tolua_err) ||
     !tolua_isstring(tolua_S,3,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,5,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  const char* username = ((const char*)  tolua_tostring(tolua_S,2,0));
  const char* password = ((const char*)  tolua_tostring(tolua_S,3,0));
  char age = ((char)  tolua_tonumber(tolua_S,4,0));
  {
   CUser* tolua_ret = (CUser*)  Mtolua_new((CUser)(username,password,age));
    tolua_pushusertype(tolua_S,(void*)tolua_ret,"CUser");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: new_local of class  CUser */
#ifndef TOLUA_DISABLE_tolua_User_CUser_new00_local
static int tolua_User_CUser_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"CUser",0,&tolua_err) ||
     !tolua_isstring(tolua_S,2,0,&tolua_err) ||
     !tolua_isstring(tolua_S,3,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,5,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  const char* username = ((const char*)  tolua_tostring(tolua_S,2,0));
  const char* password = ((const char*)  tolua_tostring(tolua_S,3,0));
  char age = ((char)  tolua_tonumber(tolua_S,4,0));
  {
   CUser* tolua_ret = (CUser*)  Mtolua_new((CUser)(username,password,age));
    tolua_pushusertype(tolua_S,(void*)tolua_ret,"CUser");
    tolua_register_gc(tolua_S,lua_gettop(tolua_S));
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: getUsername of class  CUser */
#ifndef TOLUA_DISABLE_tolua_User_CUser_getUsername00
static int tolua_User_CUser_getUsername00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"const CUser",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  const CUser* self = (const CUser*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'getUsername'", NULL);
#endif
  {
   const char* tolua_ret = (const char*)  self->getUsername();
   tolua_pushstring(tolua_S,(const char*)tolua_ret);
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'getUsername'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: setUsername of class  CUser */
#ifndef TOLUA_DISABLE_tolua_User_CUser_setUsername00
static int tolua_User_CUser_setUsername00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"CUser",0,&tolua_err) ||
     !tolua_isstring(tolua_S,2,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,3,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  CUser* self = (CUser*)  tolua_tousertype(tolua_S,1,0);
  const char* username = ((const char*)  tolua_tostring(tolua_S,2,0));
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'setUsername'", NULL);
#endif
  {
   self->setUsername(username);
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'setUsername'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: getPassword of class  CUser */
#ifndef TOLUA_DISABLE_tolua_User_CUser_getPassword00
static int tolua_User_CUser_getPassword00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"const CUser",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  const CUser* self = (const CUser*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'getPassword'", NULL);
#endif
  {
   const char* tolua_ret = (const char*)  self->getPassword();
   tolua_pushstring(tolua_S,(const char*)tolua_ret);
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'getPassword'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: setPassword of class  CUser */
#ifndef TOLUA_DISABLE_tolua_User_CUser_setPassword00
static int tolua_User_CUser_setPassword00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"CUser",0,&tolua_err) ||
     !tolua_isstring(tolua_S,2,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,3,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  CUser* self = (CUser*)  tolua_tousertype(tolua_S,1,0);
  const char* password = ((const char*)  tolua_tostring(tolua_S,2,0));
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'setPassword'", NULL);
#endif
  {
   self->setPassword(password);
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'setPassword'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: getAge of class  CUser */
#ifndef TOLUA_DISABLE_tolua_User_CUser_getAge00
static int tolua_User_CUser_getAge00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"const CUser",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  const CUser* self = (const CUser*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'getAge'", NULL);
#endif
  {
   const char tolua_ret = (const char)  self->getAge();
   tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'getAge'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: setAge of class  CUser */
#ifndef TOLUA_DISABLE_tolua_User_CUser_setAge00
static int tolua_User_CUser_setAge00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"CUser",0,&tolua_err) ||
     !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,3,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  CUser* self = (CUser*)  tolua_tousertype(tolua_S,1,0);
  char age = ((char)  tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'setAge'", NULL);
#endif
  {
   self->setAge(age);
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'setAge'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* Open function */
TOLUA_API int tolua_User_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,0);
 tolua_beginmodule(tolua_S,NULL);
  #ifdef __cplusplus
  tolua_cclass(tolua_S,"CUser","CUser","",tolua_collect_CUser);
  #else
  tolua_cclass(tolua_S,"CUser","CUser","",NULL);
  #endif
  tolua_beginmodule(tolua_S,"CUser");
   tolua_function(tolua_S,"new",tolua_User_CUser_new00);
   tolua_function(tolua_S,"new_local",tolua_User_CUser_new00_local);
   tolua_function(tolua_S,".call",tolua_User_CUser_new00_local);
   tolua_function(tolua_S,"getUsername",tolua_User_CUser_getUsername00);
   tolua_function(tolua_S,"setUsername",tolua_User_CUser_setUsername00);
   tolua_function(tolua_S,"getPassword",tolua_User_CUser_getPassword00);
   tolua_function(tolua_S,"setPassword",tolua_User_CUser_setPassword00);
   tolua_function(tolua_S,"getAge",tolua_User_CUser_getAge00);
   tolua_function(tolua_S,"setAge",tolua_User_CUser_setAge00);
  tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 return 1;
}


#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
 TOLUA_API int luaopen_User (lua_State* tolua_S) {
 return tolua_User_open(tolua_S);
};
#endif

